<?php
    class translator extends Model {
        function translator () {
            parent::Model();            
        }
        public function seo_data($page) {
            return $this->db->get_where('seo', array('languages_id'=> $this->lang_ses->getlang(),'page' =>$page))->result();            
        }
        public function mainnav()  {
            $res = $this->db->order_by('position', 'asc')->get_where('mainnav', array('languages_id'=> $this->lang_ses->getlang()))->result();            
            return $res;
        }
        public function subnav(){
            $res = $this->db->order_by('position','asc')->get_where('subnav',array('languages_id'=> $this->lang_ses->getlang()))->result();
            return $res;
        }
        public function hotels()  {
            return $this->db->order_by('id', 'asc')->get_where('hotels', array('languages_id'=> $this->lang_ses->getlang()))->result();
        }

        public function partners()  {
            return $this->db->order_by('id', 'asc')->get_where('partners', array('languages_id'=> $this->lang_ses->getlang()))->result();
        }
        public function news()  {
            return $this->db->order_by('id', 'desc')->get_where('news', array('languages_id'=> $this->lang_ses->getlang()))->result();
        }
        public function excursions()  {
            $res = $this->db->order_by('position', 'asc')->get_where('excursions', array('languages_id'=> $this->lang_ses->getlang()))->result();
            $excursions = Array();
            foreach($res as $row){
                $excursions[$row->position]['id']= $row->id; 
                $excursions[$row->position]['title']= $row->title; 
                $excursions[$row->position]['text']= $row->text;
            }
            return $excursions;
        }
        public function tours($tour_id)  {
            $res = $this->db->order_by('no', 'asc')->get_where('tourdays', array('languages_id'=> $this->lang_ses->getlang(),'tours_id'=>$tour_id))->result();
            $tours = Array();
            foreach($res as $row){
                $tours[$row->no]['id']= $row->id; 
                $tours[$row->no]['title']= $row->title; 
                $tours[$row->no]['text']= $row->text;
            }
            return $tours;
        }
        public function bustours()  {
            $res = $this->db->get_where('bustours', array('languages_id'=> $this->lang_ses->getlang()))->result();
            $bustours = Array();
            foreach($res as $row){
                $bustours[$row->bustour_txt_id]['title']= $row->title; 
                $bustours[$row->bustour_txt_id]['text']= $row->text;
                $bustours[$row->bustour_txt_id]['capacity']= $row->capacity;
                $bustours[$row->bustour_txt_id]['included']= $row->included;
            }
            return $bustours;
        }
    }
?>
